﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


class QuickSort
{
    static List<string> QuickSortMethod(List<string> List)
    {
        List<string> SortedList = new List<string>();
        int PivotIndex = List.Count / 2;
        if (List.Count <= 1)
        {
            return List;
        }
        List<string> LeftSide = new List<string>();
        List<string> RightSide = new List<string>();
        for (int i = 0; i < PivotIndex; i++)
        {
            int Comapre = List[i].CompareTo(List[PivotIndex]);
            if (Comapre <= 0)
            {
                LeftSide.Add(List[i]);
            }
            else
            {
                RightSide.Add(List[i]);
            }
        }
        for (int i = PivotIndex+1; i < List.Count; i++)
        {
            int Comapre = List[i].CompareTo(List[PivotIndex]);
            if (Comapre <= 0)
            {
                LeftSide.Add(List[i]);
            }
            else
            {
                RightSide.Add(List[i]);
            }
        }
        SortedList.AddRange(QuickSortMethod(LeftSide));
        SortedList.Add(List[PivotIndex]);
        SortedList.AddRange(QuickSortMethod(RightSide));
        return SortedList;
    }
    static void Main()
    {
        List<string> MyList = new List<string>() { "Damqn", "Asen", "Elena", "Qna", "Bobi", "Hristo", "Georgi" , "Ceco"};
        List<string> SortedNames = QuickSortMethod(MyList);
        for (int i = 0; i < SortedNames.Count; i++)
        {
            Console.WriteLine(SortedNames[i]);
        }
        Console.WriteLine();
    }
}
